package com.yeyks.controller.platform;

import com.yeyks.account.dal.domain.AccountInfo;
import com.yeyks.common.appcommon.dto.platform.AppActivityInfoDTO;
import com.yeyks.common.appcommon.dto.account.AppAccountDTO;
import com.yeyks.common.appcommon.param.platform.QueryActivityParam;
import com.yeyks.common.appcommon.result.CommonPage;
import com.yeyks.common.appcommon.result.CommonResult;
import com.yeyks.common.utils.apputil.bean.MyBeanUtils;
import com.yeyks.commonReference.service.other.ActivityInfoService;
import com.yeyks.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author: gui
 * @date: 2019/5/30 0030 10:05
 */
@Api(tags = "AppActivityController_活动通知接口",description = "活动通知相关接口【查询】")
@RestController
@RequestMapping("/platform/activity")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppActivityController extends BaseController {


    private final ActivityInfoService activityInfoService;


    @ApiOperation("分页查询活动通知列表")
    @PostMapping("/list")
    public CommonResult<CommonPage<AppActivityInfoDTO>> list(@Valid QueryActivityParam param){

        AppAccountDTO appAccountDTO = validToken(param.getToken(),
                param.getVersion(), param.getPlatform());
        return activityInfoService.selectPageByParam(param, MyBeanUtils.convert(appAccountDTO, AccountInfo.class));
        //return activityService.list(param);
    }


}
